import React from 'react';
import { connect } from 'react-redux'
import {Router,Route,hashHistory,IndexRoute,IndexRedirect} from 'react-router';
require('../static/css/media.css');
//共享导航
import ScrollMenu from '../components/commons/ScrollMenu';

import AppView from './AppView';
import IndexView from './IndexView';

import Index from '../components/index'; // 首页
  //index children
  import Community from '../components/community';// 俪社
  import Order from '../components/order';// 定制
  import TransfromView from '../components/transformView';// 蜕变
    import theme_a from '../components/transform_them/a';// 推荐
    import theme_b from '../components/transform_them/b';// 推荐
    import theme_c from '../components/transform_them/c';// 推荐
    import theme_d from '../components/transform_them/d';// 推荐
    import theme_e from '../components/transform_them/e';// 推荐
    import theme_f from '../components/transform_them/f';// 推荐
    import art_det from '../components/transform_them/art_det';// 推荐



import UserView from './userView';// 个人中心
  import user from '../components/user';

import MallView from './mallView';// 甄选
  //Mall children
  import Mall_them_meif from '../components/mall_them/Mall_them_meif';
  import Mall_them_weiz from '../components/mall_them/Mall_them_weiz';
  import Mall_them_doc from '../components/mall_them/Mall_them_doc';
  import Mall_them_hos from '../components/mall_them/Mall_them_hos';
  import Doc_det from '../components/mall_them/doc_det';
  import Hos_det from '../components/mall_them/hos_det';
  import Pro_list from '../components/mall_them/pro_list';
  import Brand_zone from '../components/mall_them/brand_zone';
  import Serv_det from '../components/mall_them/serv_det';

import CrowdFunding from './crowdFunding';// 众筹


var App = React.createClass({
  render(){
    return(
      <div>
        <Router history={this.props.history}>
          {/* mall -> children */}
          <Route path='/doc/det' component={Doc_det} />
          <Route path='/hos/det' component={Hos_det} />
          <Route path='/pro/list' component={Pro_list} />
          <Route path='/serv/det' component={Serv_det} />
          <Route path='/art/detial/:id' component={art_det} />

          <Route path="/" component={AppView}>
            <IndexRedirect to='/indexView' />

            <Route path='indexView' component={IndexView} >
              <IndexRedirect to='to_index' />
              <Route path='to_index' component={Index} />
              <Route path='community' component={Community} />
              <Route path='order' component={Order} />
              {/* 蜕变 */}
              <Route path='transformView' component={TransfromView}>
                <IndexRedirect to='theme_a' />
                <Route path='theme_a' component={theme_a} />
                <Route path='theme_b' component={theme_b} />
                <Route path='theme_c' component={theme_c} />
                <Route path='theme_d' component={theme_d} />
                <Route path='theme_e' component={theme_e} />
                <Route path='theme_f' component={theme_f} />
              </Route>
            </Route>

            {/* 甄选mall */}
            <Route path="mallView" component={MallView} >
              <IndexRedirect to='them_weiz' />
              <Route path="them_weiz" component={Mall_them_weiz} />
              <Route path="them_meif" component={Mall_them_meif} />
              <Route path="them_doc" component={Mall_them_doc} />
              <Route path="them_hos" component={Mall_them_hos} />
            </Route>
            {/* mall -> 品牌专区 */}
            <Route path="brand/zone" component={Brand_zone} />

            <Route path="crowdFunding" component={CrowdFunding} />

            {/* 用户中心 */}
            <Route path="userView" component={UserView} >
              <IndexRedirect to='user' />
              <Route path="user" component={user} />
            </Route>
          </Route>
          {/* ↑ AppView end */}
        </Router>

        <div id="loading" style={{display:this.props.store.getState().app.loading?'block':'none'}}>
          123
        </div>
      </div>
    )
  }
})

export default App;
